package com.pp.math;

public class EllipseEquation {

    private float aSegment;
    private float bSegment;

    public EllipseEquation(float a, float b) {
	aSegment = a;
	bSegment = b;
    }

    public double computeX(float yVal) {
	float theSplit = square(aSegment) * (square(bSegment) - square(yVal));
	float divisor = square(bSegment);

	return Math.sqrt(theSplit / divisor);
    }

    public double computeY(float xVal) {
	float theSplit = square(bSegment) * (square(aSegment) - square(xVal));
	float divisor = square(aSegment);

	return Math.sqrt(theSplit / divisor);
    }

    private float square(float val) {
	return val * val;
    }
}